let http = require('http');
let util = require('util');//对接口进行调试

http.get('http://www.imooc.com/index/getstarlist',function(res){
   let data = '';
   res.on("data",function(chunk){
      data += chunk;
   });//监听data数据的变化
   res.on("end",function(){
      let result = JSON.parse(data);
      console.log(util.inspect(result));
   });//监听结束
});